package ie.timalb.test.chess.rules;

import ie.timalb.chess.Board;
import ie.timalb.chess.Location;
import ie.timalb.chess.Movement;
import ie.timalb.chess.Piece;
import ie.timalb.chess.pieces.Pawn;
import ie.timalb.chess.rules.RulesEngine;
import junit.framework.TestCase;

public class EngineRulesTester extends TestCase{
	public void testOkMovingPawnSquareAhead1 ()
	{
		Location sourceLoc = new Location (2,2);
		Location finalLoc = new Location (2,3);
		Piece pieceToMove = new Pawn ();
		RulesEngine rulesEng = new RulesEngine();
		Board board = new Board();
		boolean isValidated = false;
		
		Movement movToTest = new Movement (pieceToMove, sourceLoc, finalLoc);
		isValidated = rulesEng.ValidateMovement(movToTest, board);
		assertEquals(isValidated, true);
	}	
	
	public void testOkMovingPawnSquareAhead2 ()
	{
		Location sourceLoc = new Location (4,5);
		Location finalLoc = new Location (4,6);
		Piece pieceToMove = new Pawn ();
		RulesEngine rulesEng = new RulesEngine();
		Board board = new Board();
		boolean isValidated = false;
		
		Movement movToTest = new Movement (pieceToMove, sourceLoc, finalLoc);
		isValidated = rulesEng.ValidateMovement(movToTest, board);
		assertEquals(isValidated, true);
	}
	
	public void testKoMovingPawn3SquaresAhead1 ()
	{
		Location sourceLoc = new Location (4,5);
		Location finalLoc = new Location (4,8);
		Piece pieceToMove = new Pawn ();
		RulesEngine rulesEng = new RulesEngine();
		Board board = new Board();
		boolean isValidated = false;
		
		Movement movToTest = new Movement (pieceToMove, sourceLoc, finalLoc);
		isValidated = rulesEng.ValidateMovement(movToTest, board);
		assertEquals(isValidated, true);
	}
}
